﻿<title>评论</title>
<link type="text/css" href="${ctx}/resources/css/ace.min.1.css"  rel="stylesheet" />
<table>
<tr>
<th>评论列表:</th>
	<th width="70px;" class="label label-sm label-light arrowed"><a href="${ctx}/admin/interact/list${suffix}">不限</a></th>
	<#assign sTypes = dicSetting.getParameterMap("interact.type")> 
<!--	<#list sTypes?keys as key>
		<#if key_index lt 10>
			<th width="70px;" class="label label-sm label-warning arrowed"><a href="${ctx}/admin/interact/list${suffix}?type=${key}">${sTypes[key]}</a></th>
		</#if>
	</#list>-->
</tr>
</table>

<div class="hr hr-5"></div>
<div class="row">
	<div class="col-xs-12">
		<div class="table-responsive">
			<table id="sample-table-1" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>用户Id</th>
						<th>评论内容</th>
 						<th>评论图片</th>
						<th>发布时间</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<#list list as u>
				<tr>
						<td>${u.id!}</td>
						<td>${u.userId!}</td>
						<td>${u.content!}</td>
						<td>
							<#list gsonUtils.getImgsJsonListSplit(u.urlList)! as url>
								<span class="profile-picture">
									<img style="height:105px;width:250px;" class="editable img-responsive" src="${tagUtils.getFileFullPath(url)}" />
								</span>
								<#break>
							</#list>
						</td>
						<td>
							<#if u.createTime??>
								${tagUtils.formatDate(u.createTime)!}
							</#if>
						</td>
							<td>
						<#if u.state == 2>
							<input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" onchange="doUserState(this,'${u.id}');" id="off_state"/>
							<span class="lbl"></span>
						<#else>
							<input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" onchange="doUserState(this,'${u.id}');" checked="checked" id="off_state"/>
							<span class="lbl"></span>
						</#if>
						</td>
							<td>
								<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
									
									<a class="red" onclick="isDel('${ctx}/admin/comment/delete-${u.id}-${u.type}${suffix}')" alt="Delete">
										<i class="icon-trash bigger-130" title="删除"></i> 
									</a>
								</div>
							</td>
							</tr>
				</#list>
				</tbody>
			</table>
		</div>
	
		<div class="hr hr-18 dotted hr-double"></div>
	</div><!-- /span -->
</div><!-- /row -->

<#if errorMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer red"></i>
		<span class="pink">${errorMsg!}</span>
	</h4>
</#if>

<#if infoMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer green"></i>
		<span class="pink">${infoMsg}</span>
	</h4>
</#if>

<script>
function isDel(url){
		if(!confirm("确认要删除？")){ 
				return false;		
		}else{
			location.href = url;
		}
	}
$(document).ready(function(){
	RP.addBreadcrumb([ {name:"互动列表", active: true}]);
	$("#breadcrumbs ul").append('&nbsp;&nbsp;&nbsp;&nbsp;');
});
function doUserState(checkbox,id) {
		if(checkbox.checked) {
			$.ajax({
			async : false,
	        cache : false,
	        type : 'POST',
	        dataType :JSON,
	        url : "${ctx}/admin/comment/on?id="+id,
	        error : function(data){
	        	var str = data.responseText;
	        	if(str.indexOf("true")>0){
    				location.href = location.href;
    			}else{
    			}
	        }
			});
		} else {
			$.ajax({
			async : false,
	        cache : false,
	        type : 'POST',
	        dataType :JSON,
	        url : "${ctx}/admin/comment/off?id="+id,
	        error : function(data){
	        	var str = data.responseText;
	        	if(str.indexOf("true")>0){
    				location.href = location.href;
    			}else{
    			}
	        }
			});
		}
	}
</script>